<?php

class LoginController extends CommonController{
	public function index(){
		if(isset($_SESSION['aid']) && isset($_SESSION['username'])){
			go('Index/index');
		}
		if(IS_POST){
			$model = K('Login');
			if(!$data = $model->login_validate()){
				$this->error($model->error);
			}
			session('aid',$data['aid']);
			session('adminname',$data['adminname']);
			$this->success('登录成功',U('Index/index'));
			
		}
		
			
		$this->display();
	}
	
	
	
	
	public function code(){
		$code = new code();
		$code-> show();
	}
	
	
	
	
}
